package com.commons.tools.easemob.been;

import java.util.ArrayList;
import java.util.List;

/**
 * @Date:2017年10月11日
 * @Copyright (c) 2017, donnie4w@gmail.com All Rights Reserved.
 * @Author: dong
 * @Desc: 创建群请求Bean
 */
public class ChatRoomC {
	private String groupname;
	private String desc;
	private boolean _public;
	private int maxusers;
	private boolean members_only;
	private boolean allowinvites;
	private String owner;
	private List<String> members = new ArrayList<>();

	public String toJson() {
		String mbs = null;
		if (members.size() > 0) {
			StringBuilder sb = new StringBuilder();
			for (String s : members) {
				sb.append("\"").append(s).append("\",");
			}
			mbs = sb.delete(sb.length() - 1, sb.length()).toString();
		}

		String s = "{\"members_only\":" + members_only + ",\"allowinvites\":" + allowinvites + ",\"groupname\":\""
				+ groupname + "\",\"desc\":\"" + desc + "\",\"public\":" + _public + ",\"maxusers\":" + maxusers
				+ ",\"owner\":\"" + owner + "\",\"maxusers\":" + maxusers;
		if (mbs != null) {
			s = s + ",\"members\":[" + mbs + "]}";
		}else {
			s = s+"}";
		}
		return s;
	}

	public String getGroupname() {
		return groupname;
	}

	public void setGroupname(String groupname) {
		this.groupname = groupname;
	}

	public String getDesc() {
		return desc;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}

	public boolean is_public() {
		return _public;
	}

	public void set_public(boolean _public) {
		this._public = _public;
	}


	public int getMaxusers() {
		return maxusers;
	}

	public void setMaxusers(int maxusers) {
		this.maxusers = maxusers;
	}

	public boolean isMembers_only() {
		return members_only;
	}

	public void setMembers_only(boolean members_only) {
		this.members_only = members_only;
	}

	public boolean isAllowinvites() {
		return allowinvites;
	}

	public void setAllowinvites(boolean allowinvites) {
		this.allowinvites = allowinvites;
	}

	public String getOwner() {
		return owner;
	}

	public void setOwner(String owner) {
		this.owner = owner;
	}

	public List<String> getMembers() {
		return members;
	}

	public void setMembers(List<String> members) {
		this.members = members;
	}

}
